Don't write empty routes. From Andrew.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 19 Jul 2005 22:05:18 +0000 (22:05 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 19 Jul 2005 22:05:18 +0000 (22:05 +0000)
gpsbabel/kml.c

index 470e47714e40f83f806bbd67fb2b2f04ba88f705..3f79b98c0b0ac500f7136f5d48499796c89cd80b 100644 (file)
@@ -199,7 +199,7 @@ static void kml_output_header(const route_head *header)
        write_optional_xml_entity(ofd, "  ", "name", header->rte_name);
        write_optional_xml_entity(ofd, "  ", "desc", header->rte_desc);
 
-        if (export_points) {
+        if (export_points && header->rte_waypt_ct > 0) {
           // Put the points in a subfolder
           fprintf(ofd, "  <Folder>\n");
           fprintf(ofd, "    <visibility>1</visibility>\n");
@@ -238,16 +238,16 @@ static void kml_output_point(const waypoint *waypointp, const char *style)
 }
 
 
-static void kml_output_tailer()
+static void kml_output_tailer(const route_head *header)
 {
   int i;
 
-  if (export_points) {
+  if (export_points && point3d_list_len > 0) {
     fprintf(ofd, "  </Folder>\n");
   }
   
   // Add a linestring for this track?
-  if (export_lines) {
+  if (export_lines && point3d_list_len > 0) {
     fprintf(ofd, "\t<Placemark>\n");
     fprintf(ofd, "\t  <styleUrl>#lineStyle</styleUrl>\n");
     fprintf(ofd, "\t  <name>Path</name>\n");
@@ -321,7 +321,7 @@ static void kml_track_disp(const waypoint *waypointp)
 
 static void kml_track_tlr(const route_head *header) 
 {
-  kml_output_tailer();
+  kml_output_tailer(header);
 }
 
 /*
@@ -340,7 +340,7 @@ static void kml_route_disp(const waypoint *waypointp)
 
 static void kml_route_tlr(const route_head *header) 
 {
-        kml_output_tailer();
+        kml_output_tailer(header);
 }
 
 void kml_write(void)